package ar.com.temporis.system.persistence;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import ar.com.temporis.framework.repository.AbstractRepository;
import ar.com.temporis.system.domain.User;


/**
 * 
 * @author matias.sulik
 * 
 */
public class UserRepositoryImpl extends AbstractRepository implements
		UserRepository {

	@Override
	protected Class<?> getPersistedType() {
		return User.class;
	}

	public User findUserBy(String username, String password) {
		Criteria criteria = createCriteria();

		criteria.add(Restrictions.eq("username", username)).add(
				Restrictions.eq("password", password));

		return (User) criteria.uniqueResult();
	}

}
